package com.example.inner_class;

public class AnonymousInnerClass {
    private String MemberValue="我是外部类的方法";
    public String MemberValue2="我是外部类的方法";
    private static String MemberValue3="我是外部类的方法";
    public static String MemberValue4="我是外部类的方法";
    public void method2(){
        System.out.println("我是外部类的方法");
    }
    //接口
    interface Animal{
        void run();
        void call();
    }
    //外部类的方法
    public void dog(){
        Animal animal = new Animal() {
            public void run() {
                System.out.println("跑");
                System.out.println(MemberValue);
                System.out.println(MemberValue2);
                System.out.println(MemberValue3);
                System.out.println(MemberValue4);
                method2();
            }

            public void call() {
                System.out.println("叫");
            }
        };
        animal.run();
        animal.call();

    }
}
